import request from '../util/request'

export function getHospitalList (data) {
  return request({
    url: '/hospital-system/user/hospital/list',
    method: 'post',
    data: {
      hospitalName: data.hospitalName,
      currentPage: data.currentPage,
      pageSize: data.pageSize,
      status: data.status
    }
  })
}
export function getDoctorBookCase (data) {
  return request({
    url: '/hospital-system/user/doctor/book-case',
    method: 'post',
    data: {
      doctorUuid: data.doctorUuid,
      hospitalUuid: data.hospitalUuid
    }
  })
}

export function makeBookCase (data) {
  return request({
    url: '/hospital-system/user/doctor/order',
    method: 'post',
    data: {
      doctorUuid: data.doctorUuid,
      hospitalUuid: data.hospitalUuid,
      detailUuid: data.detailUuid
    }
  })
}

export function getBookDetail (data) {
  return request({
    url: '/hospital-system/user/user/order-history',
    method: 'post',
    data: {
      status: data.status,
      currentPage: data.currentPage,
      pageSize: data.pageSize
    }
  })
}

export function deleteBook (data) {
  return request({
    url: '/hospital-system/user/doctor/order-delete',
    method: 'delete',
    data: {
      hospitalUuid: data.hospitalUuid,
      doctorUuid: data.doctorUuid,
      detailUuid: data.detailUuid,
      orderUuid: data.orderUuid,
      isLevelChange: data.isLevelChange
    }
  })
}

// 用户获取快递地址
export function getListAddress () {
  return request({
    url: '/hospital-system/address/list',
    method: 'get'
  })
}

// 根据uuid设置默认收货地址
export function setAddressDefault (data) {
  return request({
    url: '/hospital-system/address/default',
    method: 'post',
    data: {
      uuid: data.uuid
    }
  })
}

// 查找默认收货地址
export function getAddressDefault () {
  return request({
    url: '/hospital-system/address/search-default',
    method: 'get'
  })
}

// 添加快递地址信息
export function addAddressMessage (data) {
  return request({
    url: '/hospital-system/address/add',
    method: 'post',
    data: {
      province: data.province,
      city: data.city,
      area: data.area,
      town: data.town,
      detail: data.detail,
      userName: data.userName,
      tel: data.tel
    }
  })
}
// 删除快递信息
export function deleteAddressMessage (data) {
  return request({
    url: '/hospital-system/address/delete',
    method: 'post',
    data: {
      uuid: data.uuid
    }
  })
}

// 更新快递信息
export function updateAddressMessage (data) {
  return request({
    url: '/hospital-system/address/update',
    method: 'post',
    data: {
      uuid: data.uuid,
      province: data.province,
      city: data.city,
      area: data.area,
      town: data.town,
      userName: data.userName,
      detail: data.detail,
      tel: data.tel
    }
  })
}

// 查询药品列表
export function getMedicalList (data) {
  return request({
    url: '/hospital-system/user/user/medical-list',
    method: 'post',
    data: {
      pageSize: data.pageSize,
      lastPage: data.lastPage,
      total: data.total,
      currentPage: data.currentPage,
      hospitalUuid: data.hospitalUuid,
      type: data.type,
      msg: data.msg,
      according: data.according,
      sort: data.sort
    }
  })
}

// 添加购物车
export function addShoppingCart (data) {
  return request({
    url: '/hospital-system/shopping-cart/add',
    method: 'post',
    data: {
      medicalUuid: data.medicalUuid,
      count: data.count,
      hospitalUuid: data.hospitalUuid
    }
  })
}

// 查询购物车
export function getShoppingCart (data) {
  return request({
    url: '/hospital-system/shopping-cart/get',
    method: 'post',
    data: {
      pageSize: data.pageSize,
      currentPage: data.currentPage,
      type: data.type,
      searchName: data.searchName
    }
  })
}

// 修改购物车数量
export function changeShoppingCart (data) {
  return request({
    url: '/hospital-system/shopping-cart/change',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      medicalUuid: data.medicalUuid,
      count: data.count
    }
  })
}

// 删除购物车物品
export function deleteShoppingCart (data) {
  return request({
    url: '/hospital-system/shopping-cart/delete',
    method: 'post',
    data: {
      list: data.list
    }
  })
}

// 下单前结算界面商品
export function beforePlaceOrder (data) {
  return request({
    url: '/hospital-system/order/before-placeOrder',
    method: 'post',
    data: {
      list: data.list
    }
  })
}

// 下单
export function placeOrder (data) {
  return request({
    url: '/hospital-system/order/buy-medical',
    method: 'post',
    data: {
      addressUuid: data.addressUuid,
      list: data.list
    }
  })
}

// 获取订单
export function getOrder (data) {
  return request({
    url: '/hospital-system/order/list',
    method: 'post',
    data: {
      currentPage: data.currentPage,
      pageSize: data.pageSize,
      status: data.status,
      hospitalUuid: data.hospitalUuid
    }
  })
}

// 获取快递信息
export function getExpress (data) {
  return request({
    url: '/hospital-system/order/get-detail',
    method: 'post',
    data: {
      userUuid: data.userUuid,
      orderUuid: data.orderUuid
    }
  })
}

// 撤销订单
export function deleteOrder (data) {
  return request({
    url: '/hospital-system/order/delete',
    method: 'post',
    data: {
      orderUuid: data.orderUuid
    }
  })
}

// 确认收货
export function successOrder (data) {
  return request({
    url: '/hospital-system/order/success',
    method: 'post',
    data: {
      orderUuid: data.orderUuid
    }
  })
}
